<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>非遗百科 - 用户简介</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', Arial, sans-serif;
            background-color: #f5f5f5;
            padding: 0;
            margin: 0;
        }
        
        /* 头部导航栏样式 */
        .header {
            background-color: rgb(135, 73, 73);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            padding: 20px 25px;
            display: flex;
            flex-direction: row;
            align-items: center;
            justify-content: space-between;
            position: sticky;
            top: 0;
            z-index: 1001;
        }
        
        /* 左侧导航组 */
        .nav-left {
            display: flex;
            align-items: center;
            gap: 20px;
        }
        
        /* 中间主题切换 */
        .nav-center {
            display: flex;
            align-items: center;
            flex: 1;
            justify-content: center;
        }
        
        /* 右侧用户设置 */
        .nav-right {
            display: flex;
            align-items: center;
        }
        
        /* 首页按钮样式 */
        .home-button {
            background-color: rgba(255, 255, 255, 0.2);
            padding: 8px 15px;
            border-radius: 20px;
            margin-right: 15px;
            transition: all 0.3s ease;
        }
        
        .home-button:hover {
            background-color: rgba(255, 255, 255, 0.3);
        }
        
        body.dark-mode .home-button {
            background-color: rgba(255, 255, 255, 0.1);
        }
        
        body.dark-mode .home-button:hover {
            background-color: rgba(255, 255, 255, 0.2);
        }
        
        /* 模式切换按钮样式 */
        .theme-toggle {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background-color: #f0f0f0;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            margin-right: 15px;
        }
        
        .theme-toggle:hover {
            background-color: #e0e0e0;
            transform: rotate(15deg);
        }
        
        .theme-toggle svg {
            width: 20px;
            height: 20px;
            fill: #666;
        }
        
        /* 暗色模式样式 */
        body.dark-mode {
            background-color: #1a1a1a;
            color: #e0e0e0;
        }
        
        body.dark-mode .header {
            background-color: #2a2a2a;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        }
        
        body.dark-mode .category-title {
            background-color: #3a3a3a;
            color: #e0e0e0;
        }
        
        body.dark-mode .category-title:hover {
            background-color: #4a4a4a;
        }
        
        body.dark-mode .category-dropdown {
            background-color: #2a2a2a;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
        }
        
        body.dark-mode .category-item {
            color: #e0e0e0;
        }
        
        body.dark-mode .category-item:hover {
            background-color: #3a3a3a;
        }
        
        body.dark-mode .user-avatar {
            background-color: #3a3a3a;
        }
        
        body.dark-mode .user-avatar:hover {
            background-color: #4a4a4a;
        }
        
        body.dark-mode .user-avatar.visitor::after {
            color: #999;
        }
        
        /* 类别目录样式 */
        .category-nav {
            position: relative;
            display: flex;
            align-items: center;
        }
        
        .category-title {
            background-color: #f0f0f0;
            padding: 8px 15px;
            border-radius: 20px;
            cursor: pointer;
            font-weight: bold;
            color: #666;
            transition: all 0.3s ease;
            user-select: none;
        }
        
        .category-title:hover {
            background-color: #e0e0e0;
        }
        
        .category-dropdown {
            position: absolute;
            top: 100%;
            left: 0;
            margin-top: 10px;
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            overflow: hidden;
            z-index: 1000;
            display: none;
            min-width: 150px;
        }
        
        .category-nav:hover .category-dropdown {
            display: block;
        }
        
        .category-item {
            padding: 12px 15px;
            cursor: pointer;
            transition: background-color 0.3s ease;
            color: #333;
            white-space: nowrap;
        }
        
        .category-item:hover {
            background-color: #f5f5f5;
        }
        
         
        
        /* 内容容器样式 */
        .content-container {
            max-width: 1200px;
            margin: 20px auto;
            padding: 0 20px;
        }
        
        .content-container h1 {
            margin-bottom: 20px;
            color: #333;
            font-size: 28px;
            text-align: center;
        }
        
        /* 通用内容区块样式 */
        .content-section {
            background-color: white;
            border-radius: 10px;
            padding: 20px;
            margin-bottom: 20px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        }
        
        body.dark-mode .content-section {
            background-color: #2a2a2a;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        }
        
        /* 用户信息展示样式 */
        .user-profile {
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            padding: 30px 0;
        }
        
        .profile-avatar {
            width: 150px;
            height: 150px;
            border-radius: 50%;
            overflow: hidden;
            margin-bottom: 20px;
            border: 5px solid #f0f0f0;
        }
        
        body.dark-mode .profile-avatar {
            border-color: #3a3a3a;
        }
        
        .profile-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .profile-name {
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 10px;
            color: #333;
        }
        
        body.dark-mode .profile-name {
            color: #e0e0e0;
        }
        
        .profile-status {
            color: #666;
            margin-bottom: 20px;
        }
        
        body.dark-mode .profile-status {
            color: #999;
        }
        
        .profile-info {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 20px;
            width: 100%;
            max-width: 800px;
            margin-top: 30px;
        }
        
        .info-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 15px;
            border-radius: 8px;
            background-color: #f9f9f9;
        }
        
        body.dark-mode .info-item {
            background-color: #3a3a3a;
        }
        
        .info-value {
            font-size: 20px;
            font-weight: bold;
            color: rgb(135, 73, 73);
            margin-bottom: 5px;
        }
        
        body.dark-mode .info-value {
            color: #e0e0e0;
        }
        
        .info-label {
            color: #666;
            font-size: 14px;
        }
        
        body.dark-mode .info-label {
            color: #999;
        }
        
        /* 用户操作按钮 */
        .user-actions {
            display: flex;
            gap: 15px;
            margin-top: 20px;
        }
        
        .action-button {
            padding: 10px 20px;
            border: none;
            border-radius: 25px;
            cursor: pointer;
            font-size: 14px;
            font-weight: bold;
            transition: all 0.3s ease;
        }
        
        .action-button.edit {
            background-color: rgb(135, 73, 73);
            color: white;
        }
        
        .action-button.edit:hover {
            background-color: rgb(115, 60, 60);
            transform: translateY(-2px);
        }
        
        .action-button.logout {
            background-color: #f0f0f0;
            color: #666;
        }
        
        .action-button.logout:hover {
            background-color: #e0e0e0;
            transform: translateY(-2px);
        }
        
        body.dark-mode .action-button.logout {
            background-color: #3a3a3a;
            color: #e0e0e0;
        }
        
        body.dark-mode .action-button.logout:hover {
            background-color: #4a4a4a;
        }
        
        /* 用户收藏内容样式 */
        .favorites-section {
            margin-top: 30px;
        }
        
        .favorites-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 15px;
            margin-top: 20px;
        }
        
        .favorite-item {
            border-radius: 8px;
            overflow: hidden;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            cursor: pointer;
            transition: transform 0.3s ease;
        }
        
        .favorite-item:hover {
            transform: translateY(-5px);
        }
        
        .favorite-image {
            width: 100%;
            height: 150px;
            object-fit: cover;
        }
        
        .favorite-title {
            padding: 10px;
            font-size: 14px;
            font-weight: bold;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            color: #333;
            background-color: white;
        }
        
        body.dark-mode .favorite-title {
            color: #e0e0e0;
            background-color: #2a2a2a;
        }
        
        body.dark-mode .favorite-item {
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        }
        
        /* 响应式设计 */
        @media (max-width: 768px) {
            .header {
                padding: 10px 15px;
            }
            
            .content-container {
                padding: 0 15px;
            }
            
            .content-container h1 {
                font-size: 24px;
            }
            
            .profile-info {
                grid-template-columns: repeat(2, 1fr);
            }
            
            .favorites-grid {
                grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
            }
        }
        
        @media (max-width: 480px) {
            .header {
                flex-direction: column;
                align-items: stretch;
                gap: 10px;
            }
            
            .category-nav,
            .user-avatar {
                align-self: center;
            }
            
            .content-section {
                padding: 15px;
            }
            
            .profile-avatar {
                width: 120px;
                height: 120px;
            }
            
            .profile-name {
                font-size: 20px;
            }
            
            .profile-info {
                grid-template-columns: 1fr;
            }
            
            .user-actions {
                flex-direction: column;
                width: 100%;
                max-width: 300px;
            }
            
            .action-button {
                width: 100%;
            }
        }
        /* 用户头像样式 */
        .avatar-container {
            position: relative;
            margin-right: 15px;
        }
        
        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background-color: #f0f0f0;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
            overflow: hidden;
        }
        
        .user-avatar:hover {
            transform: scale(1.1);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        }
        
        .avatar-img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .avatar-menu {
            position: absolute;
            top: 100%;
            right: 0;
            margin-top: 10px;
            background-color: white;
            border-radius: 10px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            overflow: hidden;
            z-index: 1002;
            display: none;
            min-width: 120px;
        }
        
        .avatar-container:hover .avatar-menu {
            display: block;
        }
        
        .avatar-menu-item {
            display: flex;
            align-items: center;
            padding: 12px 15px;
            color: #333;
            text-decoration: none;
            transition: background-color 0.3s ease;
        }
        
        .avatar-menu-item:hover {
            background-color: #f5f5f5;
        }
        
        .menu-icon {
            margin-right: 10px;
            font-size: 16px;
        }
        
        .menu-text {
            font-size: 14px;
        }
        
        /* 暗色模式适配 */
        body.dark-mode .user-avatar {
            background-color: #3a3a3a;
        }
        
        body.dark-mode .avatar-menu {
            background-color: #2a2a2a;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
        }
        
        body.dark-mode .avatar-menu-item {
            color: #e0e0e0;
        }
        
        body.dark-mode .avatar-menu-item:hover {
            background-color: #3a3a3a;
        }
    </style>
    <script src="assets/js/avatarMenu.js"></script>
</head>
<body>
    <!-- 头部导航栏 -->
    <div class="header">
        <!-- 左侧导航组 -->
        <div class="nav-left">
            <!-- 首页按钮 -->
            <div class="home-button">
                <a href="index.html" style="display: flex; align-items: center; text-decoration: none; color: white;">
                    <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" style="margin-right: 5px;">
                        <path d="M12 3L2 12h3v8h6v-6h4v6h6v-8h3L12 3z"/>
                    </svg>
                    <span>首页</span>
                </a>
            </div>
            
            <!-- 类别目录栏 -->
            <div class="category-nav">
                <div class="category-title">非遗类别</div>
                <div class="category-dropdown">
                    <div class="category-item" data-category="传统技艺">传统技艺</div>
                    <div class="category-item" data-category="传统音乐">传统音乐</div>
                    <div class="category-item" data-category="传统舞蹈">传统舞蹈</div>
                    <div class="category-item" data-category="传统戏剧">传统戏剧</div>
                    <div class="category-item" data-category="传统美术">传统美术</div>
                    <div class="category-item" data-category="曲艺">曲艺</div>
                    <div class="category-item" data-category="民间文学">民间文学</div>
                    <div class="category-item" data-category="传统医药">传统医药</div>
                    <div class="category-item" data-category="民俗">民俗</div>
                </div>
            </div>
        </div>
        
        <!-- 中间主题切换 -->
        <div class="nav-center">
            <button class="theme-toggle">
                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
                    <path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/>
                </svg>
            </button>
        </div>
        
        <!-- 右侧用户设置 -->
        <div class="nav-right">
            <!-- 用户头像功能已移除 -->
        </div>
    </div>

    <!-- 主内容区域 -->
    <div class="content-container">
        <h1>用户简介</h1>
        
        <!-- 用户信息区域 -->
        <div class="content-section">
            <div class="user-profile">
                <div class="profile-avatar">
                    <img src="https://picsum.photos/seed/user/300/300" alt="用户头像">
                </div>
                <h2 class="profile-name">游客用户</h2>
                <p class="profile-status">您当前以游客身份浏览非遗百科</p>
                
                <div class="profile-info">
                    <div class="info-item">
                        <span class="info-value">0</span>
                        <span class="info-label">收藏项目</span>
                    </div>
                    <div class="info-item">
                        <span class="info-value">0</span>
                        <span class="info-label">浏览记录</span>
                    </div>
                    <div class="info-item">
                        <span class="info-value">0</span>
                        <span class="info-label">分享次数</span>
                    </div>
                    <div class="info-item">
                        <span class="info-value">0</span>
                        <span class="info-label">登录天数</span>
                    </div>
                </div>
                
                <div class="user-actions">
                    <button class="action-button edit">登录账号</button>
                    <button class="action-button logout">返回首页</button>
                </div>
            </div>
        </div>
        
        <!-- 用户收藏内容 -->
        <div class="content-section favorites-section">
            <h2>收藏的非遗项目</h2>
            <p class="profile-status">登录后即可查看您收藏的非遗项目</p>
            <div class="favorites-grid" id="favorites-grid">
                <!-- 收藏的项目将动态加载到这里 -->
                <!-- 模拟数据，登录后将替换为真实数据 -->
                <div class="favorite-item" onclick="alert('请先登录以查看收藏内容');">
                    <img src="https://picsum.photos/seed/guest1/300/200" alt="登录查看" class="favorite-image">
                    <div class="favorite-title">登录查看收藏</div>
                </div>
                <div class="favorite-item" onclick="alert('请先登录以查看收藏内容');">
                    <img src="https://picsum.photos/seed/guest2/300/200" alt="登录查看" class="favorite-image">
                    <div class="favorite-title">登录查看收藏</div>
                </div>
                <div class="favorite-item" onclick="alert('请先登录以查看收藏内容');">
                    <img src="https://picsum.photos/seed/guest3/300/200" alt="登录查看" class="favorite-image">
                    <div class="favorite-title">登录查看收藏</div>
                </div>
                <div class="favorite-item" onclick="alert('请先登录以查看收藏内容');">
                    <img src="https://picsum.photos/seed/guest4/300/200" alt="登录查看" class="favorite-image">
                    <div class="favorite-title">登录查看收藏</div>
                </div>
            </div>
        </div>
    </div>

    <script>
        // 类别目录栏点击事件处理
        document.querySelectorAll('.category-item').forEach(item => {
            item.addEventListener('click', function() {
                const category = this.getAttribute('data-category');
                window.location.href = `category.html?type=${encodeURIComponent(category)}`;
            });
        });
        
         
        
        // 为页面标题添加点击事件，跳转到首页
        document.querySelector('h1').addEventListener('click', function() {
            window.location.href = 'waterfall.html';
        });
        
        // 模式切换功能
        function setupThemeToggle() {
            const themeToggle = document.querySelector('.theme-toggle');
            const body = document.body;
            
            // 检查用户之前的主题偏好
            if (localStorage.getItem('theme') === 'dark' || 
                (!localStorage.getItem('theme') && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
                body.classList.add('dark-mode');
            } else {
                body.classList.remove('dark-mode');
            }
            
            // 添加点击事件处理
            themeToggle.addEventListener('click', function() {
                body.classList.toggle('dark-mode');
                
                // 保存用户的主题偏好
                if (body.classList.contains('dark-mode')) {
                    localStorage.setItem('theme', 'dark');
                } else {
                    localStorage.setItem('theme', 'light');
                }
            });
        }
        
        // 初始化主题切换功能
        setupThemeToggle();
        
        // 初始化用户操作按钮
        function setupUserActions() {
            const loginButton = document.querySelector('.action-button.edit');
            const backButton = document.querySelector('.action-button.logout');
            
            loginButton.addEventListener('click', function() {
                // 预留页面跳转链接位置
                // window.location.href = 'login.html';
                alert('即将跳转到登录页面');
            });
            
            backButton.addEventListener('click', function() {
                window.location.href = 'waterfall.html';
            });
        }
        
        // 初始化用户收藏内容
        function loadUserFavorites() {
            // 实际应用中，这里应该从服务器获取用户的收藏数据
            // 目前使用模拟数据
            
            // 检查用户是否已登录
            const isLoggedIn = false; // 模拟未登录状态
            
            const favoritesGrid = document.getElementById('favorites-grid');
            const sectionTitle = document.querySelector('.favorites-section h2');
            const statusText = document.querySelector('.favorites-section .profile-status');
            
            if (isLoggedIn) {
                // 已登录状态，显示真实收藏数据
                sectionTitle.textContent = '我的收藏';
                statusText.textContent = '您收藏的非遗项目将在这里展示';
                
                // 实际应用中，这里应该动态加载用户的收藏数据
            } else {
                // 未登录状态，显示登录提示
                sectionTitle.textContent = '收藏的非遗项目';
                statusText.textContent = '登录后即可查看您收藏的非遗项目';
            }
        }
        
        // 页面加载完成后初始化
        document.addEventListener('DOMContentLoaded', function() {
            setupUserActions();
            loadUserFavorites();
        });
    </script>
</body>
</html>